<?php header('Content-type:text/plain'); ?>
<?php include_once('PP.php'); ?>
<?php include_once('PPEntry.php'); ?>
<?= '<?' ?>xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
  <Document>
  <?php
    $entries = PPEntry::get_entries("geocode IS NOT NULL", null);
    foreach ($entries as $entry) {
      $h = $entry->htmlFields();
      ?>
      <Placemark>
        <name><?= $h['company_name'] ?></name>
        <description><![CDATA[
          <?= $h['summary'] ?>
          <br/>
          <?= $entry->getLink('view', 'See details in the BendTech directory ...') ?>
        ]]></description>
        <address>
          <?= $entry->getHtml('address') ?>
        </address>
        <Point>
          <coordinates><?= $entry->getGeocode() ?></coordinates>
        </Point>
      </Placemark>
  <?php } ?>
  </Document>
</kml>
<?php pp::disconnect() ?>
